<!doctype html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
	<title>登录</title>
	<link rel="stylesheet" href="css/login1.css" />
		<script type="text/javascript" src="js/zepto.min.js"></script>
		<script type="text/javascript" src="js/util.js"></script>
	</head>
	
	<body>
	<div class="login">
		<div class="welcome"><img src="img/login/welcome.png"></div>
		<div class="login-form">
			<div class="login-inp">
				<label>登录</label>
				<input type="text" placeholder="" id="username">
			</div>
			
			<div class="login-inp">
				<label>密码</label>
				<input type="password" placeholder="" id="password">
			</div>
			
			<div class="login-inp" style="text-align: center; width: 50%; margin-left: 25%; ">
				<input style="font-size: 19px;" class="user_login" type="button" value="登录"/>
			</div>
			
		
		</div>
		<div class="login-txt">
			<a href="register.html" style="font-size: 16px;">立即注册</a>|<a href="#" style="font-size: 16px;">忘记密码？</a>
		</div>
	</div>
	</body>
	<script src="js/mui.min.js"></script>
	<script src="js/app.js"></script>
	<script>
	$(function(){
		$(".user_login").on('touchend',function(){
			var username = $("#username").val();
			var password = $("#password").val();
			var param = {title:'提示',text:'',callback:function(){this.remove();}}
			if(!username){
				param.text = "请输入用户名！";
				iAlert(param);
				return;
			}
			if(!password){
				param.text = "请输入密码！";
				iAlert(param);
				return;
			}
			/*$.getJSON("localhost:8080/WBPlatform/user/login.do").then(function(obj){
				console.log(obj);
			});*/
			$.ajax({
				"url": "http://192.168.0.150/WBPlatform/user/login.do",
				"data": "username="+username+"&password="+password,
				"type": "POST", 
				"dataType": "json", 
				"xhrFields": {
           			withCredentials: true
       			},
       			"crossDomain": true,
				"success": function(obj) {
					if(obj.state==1){
						console.log(obj.message);
						location.href="center.html";
					}else{
						param.text = obj.message;
						iAlert(param);
					}
				}
			});
		});
	});
	</script>
</html>
